package wenjun.du.androidart.view

import android.util.Log
import android.view.View

/**
 * 控件的观察类
 *
 * 查看传入的view的位置属性 在动画执行前后 位置属性值的改变结果
 *
 *
 * */
object ViewUtil {
    private const val TAG = "ViewUtil"

    fun checkViewLocation(view: View) {
        val left = view.left
        val right = view.right
        val top = view.top
        val bottom = view.bottom
        val x = view.x
        val y = view.y

        val translationX = view.translationX
        val translationY = view.translationY
        Log.d(
            TAG,
            "checkViewLocation: left : $left right : $right top : $top, bottom : $bottom x : $x y : $y translationX : $translationX translationY : $translationY"
        )
    }

    fun getStringAction(value: Int?): String {
        return when (value) {
            0 -> "ACTION_DOWN"
            1 -> "ACTION_UP"
            2 -> "ACTION_MOVE"
            3 -> "ACTION_CANCEL"
            else -> "$value"
        }
    }

}

